/**
 * \file CTomcatClient.h
 * \author Corentin Le Bail
 * \date 2009-2013
 * \brief Fichier de déclaration de la classe CTomcatClient.
 */
//------------------------------------------------------------------------------
#ifndef __CTOMCATCLIENT_H__
#define __CTOMCATCLIENT_H__
//------------------------------------------------------------------------------
#include <QObject>
#include <QVariant>
#include <QMap>
#include <QNetworkReply>
#include "CRequest.h"
//------------------------------------------------------------------------------
class CTomcatClient : public QObject {
	Q_OBJECT
	public:
		CTomcatClient(void);
		QString getLastError(void) { return lastError; }
		bool authenticate(QString userName, QString passWord);
		bool report(CRequest *request, QByteArray &datas, QString &contentType);
		bool servletVersion(QString &version);
		bool databaseVersion(QString &version);
		bool getConfig(QVariantMap &config);
		bool getSchema(QString tableName, QVariantMap &schema);
	private:
		QString baseUrl;
		QString dossier;
		QString lastError;
		
		bool call(CRequest *request, QString action, QVariant &result);
	private slots:
		void onSslErrorHandler(QNetworkReply* qnr, const QList<QSslError> & );
};
//------------------------------------------------------------------------------
#endif// __CTOMCATCLIENT_H__
//------------------------------------------------------------------------------